#include <iostream>
#include <cmath>
using namespace std;
bool f(int i)
{
	return (int)sqrt(i) == sqrt(i);
}
int main()
{
	int m,n;
	cin >> m >> n;
	int b[1000005] = { 0 };
	for (int i = m;i <= n;i++)
	{
		if(f(i))
		{
			b[i] = 1;
		}
	}
	for (int i = m;i <= n;i++)
	{
		if (b[i] == 1)
		{
			int k = 10;
			for (int j = 1;j <= 5;j++)
			{
				int x = i % k;
				int y = i / k;
				if (b[x] && b[y])
				{
					cout << i;
					break;
				}
				k *= 10;
			}
		}
	}
	return 0;
}

